package view;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;

/**
 * Created with IntelliJ IDEA.
 * User: Student
 * Date: 30/11/12
 * Time: 12:54
 * To change this template use File | Settings | File Templates.
 */
public class DiceLabel extends JLabel{
    public DiceLabel(int face, int width, int height) {
        try {
            ImageIcon icon = new ImageIcon(ImageIO.read(getClass().getResourceAsStream("/resources/" + face + ".png")));
            Image img = icon.getImage();
            ImageIcon newIcon = new ImageIcon(img.getScaledInstance(width, height, Image.SCALE_SMOOTH));
            setIcon(newIcon);
        } catch(Exception e) {
            // ignore
        }
    }
}
